<!-- 官方组件请参考：https://ext.dcloud.net.cn/plugin?id=4858 -->
<template>
	<view>
		<u-popup z-index="30080" :safe-area-inset-bottom="true" mode="bottom" length="auto" v-model="openUniShare">
			<view class="u-flex-col">
				<view class="u-flex u-row-around u-p-t-30 u-p-b-30">
					<view class="u-flex-col u-col-center" @click="uniShare('WXSceneSession')">
						<u-image height="88" width="88" src="https://iconfont.alicdn.com/t/cf3ae302-f615-4bc9-afe5-e10391187de1.png"></u-image>
						<view>微信好友</view>
					</view>
					<view class="u-flex-col u-col-center" @click="uniShare('WXSenceTimeline')">
						<u-image height="88" width="88" src="https://iconfont.alicdn.com/t/45e335c2-d755-4605-8a4a-98f8165671dd.png"></u-image>
						<view>微信朋友圈</view>
					</view>
				</view>
				<u-line></u-line>
				<view @click="openUniShare = false" class="u-flex u-row-center u-p-30" style="font-size: 32rpx;color: #65676b;">
					取消分享
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		getBaseUrl
	} from '@/utils/request.config.js'
	
	export default {
		name:"dy-share",
		data() {
			return {
				data: {},
				openUniShare: false,
			};
		},
		methods: {
			uniShare(scene) {
				uni.share({
				    provider: "weixin",
				    scene: scene,
				    type: 0,
				    href: this.data.url || (getBaseUrl() + this.data.uri),
				    title: this.data.title,
				    summary: this.data.summary,
				    imageUrl: this.data.imageUrl,
				    success: function (res) {
				        console.log("success:" + JSON.stringify(res));
				    },
				    fail: function (err) {
				        console.log("fail:" + JSON.stringify(err));
				    }
				})
			}
		}
	}
</script>

<style>

</style>
